<?php require_once(dirname(__FILE__).'/inc/config.inc.php');IsModelPriv('navigation_list'); ?>
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1" />
<meta name="viewport" content="width=device-width,minimum-scale=1.0,maximum-scale=1.0,initial-scale=1.0,user-scalable=no" />
<meta name="apple-mobile-web-app-capable" content="yes" />
<title>后台菜单管理</title>
<link href="templates/css/style.css" rel="stylesheet" type="text/css" />
<link rel="stylesheet" href="../plugin/iconfont/iconfont.css">
<script type="text/javascript" charset="utf-8" src="templates/js/jquery-1.11.2.min.js"></script>
<script type="text/javascript" charset="utf-8" src="templates/js/Validform_v5.3.2_min.js"></script>
<script type="text/javascript" charset="utf-8" src="templates/js/laymain.js"></script>
<script type="text/javascript" charset="utf-8" src="templates/js/common.js"></script>
<script type="text/javascript" src="templates/js/forms.func.js"></script>
</head>
<body class="mainbody">
<form method="post" action="" id="form">
<!--导航栏-->
<div class="location">
  <a href="javascript:history.back(-1);" class="back"><i></i><span>返回上一页</span></a>
  <a href="home.php" class="home"><i></i><span>首页</span></a>
  <i class="arrow"></i>
  <span>后台菜单管理</span>
   <a href="javascript:location.reload();" class="reload">刷新</a>
</div>
<!--/导航栏-->

<!--工具栏-->
<div id="floatHead" class="toolbar-wrap">
  <div class="toolbar">
    <div class="box-wrap">
      <a class="menu-btn"></a>
      <div class="l-list">
        <ul class="icon-list">
          <li><a class="add" href="navigation_add.php"><i></i><span>新增</span></a></li>
          <li><a id="btnSave" class="save" href="javascript:UpOrderID('navigation_save.php');"><i></i><span>保存</span></a></li>
          <li><a class="all" href="javascript:;" onclick="checkAll(this);"><i></i><span>全选</span></a></li>
		<li><a href="javascript:DelAll('navigation_save.php');" onclick="return ConfDelAll(1);" class="del"><i></i><span>删除</span></a></li>
        </ul>
      </div>
    </div>
  </div>
</div>
<!--/工具栏-->

<!--列表-->
<div class="table-container">
 
	<table width="100%" border="0" cellpadding="0" cellspacing="0" class="ltable">
	  <tr>
      <th width="5%">选择</th>
      <th width="5%">ID</th>
      <th width="5%">图标</th>
      <th align="left" width="10%">调用名称</th>
      <th align="left">标题</th>
	  <th width="5%" title="是否参与权限控制">RBAC</th>
      <th align="left">权限资源</th>
      <th width="8%">显示</th>
      <th align="left" width="65">排序</th>
      <th width="20%">操作</th>
    </tr>
	<?php
	function Show($id=0, $i=0)
	{
		global $dosql,$cfg_siteid;
		$dosql->Execute("SELECT * FROM `#@__navigation` WHERE `parentid`=$id ORDER BY orderid,id ASC", $id);
		$i++;
	
		while($row = $dosql->GetArray($id))
		{
			switch($row['checkinfo'])
			{
				case 'true':
					$checkinfo = '隐藏';
					break;  
				case 'false':
					$checkinfo = '显示';
					break;
				default:
					$checkinfo = '没有获取到参数';
			}
	
			//设置$classname
			$classname = '';
			
		//设置折叠
			if($row['parentid'] == '0')
				$classname .= '<span class="minusSign" id="rowid_'.$row['id'].'" onclick="DisplayRows('.$row['id'].');">';
			else
				$classname .= '<span class="subType">';

			//设置空格
			for($n = 1; $n < $i; $n++)
				$classname .= '&nbsp;&nbsp;';

			if($row['linkurl']!='')  $link='&nbsp;(链接：'.$row['linkurl'].')';else $link='';
				if($n==1) $navname='<span style="color:#000">[导航]</span>';else $navname='';
				$classname .= '<span class="folder-line"></span><span class="folder-open"></span>&nbsp;<a href="navigation_update.php?id='.$row['id'].'">'.$row['classname'].'</a>'.$navname.$link;

	?>
	
		<tr id="rowpid_<?php echo GetTopID($row['parentstr']); ?>">

				<td align="center"><span class="checkall" style="vertical-align:middle;"><input type="checkbox" name="checkid[]" value="<?php echo $row['id']; ?>" /></span></td>
				<td align="center"><?php echo $row['id']; ?><input type="hidden"  name="id[]"id="id[]" value="<?php echo $row['id']; ?>" /></td>	
				<td align="center" ><i class="iconfont <?php echo $row['picurl'];?>"></i></td>
				<td ><?php echo $row['idname']; ?></td>
				<td ><?php echo $classname; ?></td>
				<td align="center"><?php if($row['RBAC']=='true') echo '<font color="blue">√</font>';else echo'<font color="red">×</font>'?></td>
				<td ><?php echo $row['action_type']; ?></td>
				<td align="center"><span><a href="navigation_save.php?action=check&id=<?php echo $row['id']; ?>&checkinfo=<?php echo $row['checkinfo']; ?>" title="点击进行显示与隐藏操作"><?php echo $checkinfo; ?></a></span> </td>
				<td  align="center">
				<input type="text" name="orderid[]" id="orderid[]" class="sort" value="<?php echo $row['orderid']; ?>" />
				</td>
				<td align="center" style="white-space:nowrap;word-break:break-all;overflow:hidden;"><span><a href="navigation_add.php?id=<?php echo $row['id']; ?>">添加子导航</a></span> | <span><a href="navigation_update.php?id=<?php echo $row['id']; ?>">修改</a></span> | <span class="nb"><a href="navigation_save.php?action=del&id=<?php echo $row['id'] ?>" onclick="return ConfDel(2);">删除</a></span></td>
			</tr>
	
	<?php
			Show($row['id'], $i+2);
		}
	}

	Show();


	//判断无记录样式
	if($dosql->GetTotalRow(0) == 0)
	{
		echo '<tr><td align="center" colspan="9">暂无记录</td></tr>';
	}
	
	

	?>
  	</table>
</div>
<!--/列表-->
<div class="line20"></div>
<div class="pagelist">
<div class="l-btns">
   　<span>共有<?php echo $dosql->GetTableRow('#@__navigation'); ?>条记录</span>
</div>
</div>
</form>
</body>
</html>
